<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>评论</title>
    <link rel="stylesheet" href="../layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../CSS/media.css">
    <style>
        .Modular {
            width: 100%;
            margin: 0px 0px 10px 0px;
            padding: 20px 0px;
            background: #fff;
        }

        .Modular>div {
            width: 80% !important;
            margin: auto;
        }

        .m {
            width: 80%;
            height: 540px;
            margin: auto;
            margin-top: 20px;
        }

        .m_cover_cesium {
            width: 100%;
            height: 700px;
            position: relative;
        }

        .m_cover_cesium i {
            position: absolute;
            bottom: 20px;
            right: 20px;
            cursor: pointer;
            color: #fff;
            font-weight: bold;
            font-size: 25px;
        }

        .totalOut {
            display: none;
        }

        .m_name {
            font-size: 20px;
            font-weight: bold;
            width: 50%;
            height: 60px;
            line-height: 60px;
            text-indent: 20px;
            display: inline-block;
        }

        .m_data {
            width: 50%;
            float: right;
            height: 60px;
            position: relative;
        }

        .m_data>div {
            float: right;
            margin-right: 30px;
            font-size: 16px;
            height: 60%;
            line-height: 60px;
        }

        .m_author {
            width: 100%;
            height: 150px;
            background: #fff;
            box-shadow: 0 4px 11px 0px #bbbbbb;
        }

        .m_author_photo {
            width: 70px;
            height: 70px;
            float: left;
            margin-left: 20px;
        }

        .m_author_photo img {
            width: 100%;
            border-radius: 100%
        }

        .m_author_name {
            float: left;
            margin-left: 15px;
            margin-top: 5px;
        }

        .m_author_name p {
            font-size: 16px;
            margin-bottom: 5px;
            color: #868686;
            font-weight: bold;
        }

        .m_dec {
            width: 100%;
            background: #fff;
            box-shadow: 0 4px 11px 0px #bbbbbb;
            margin-top: 20px;
        }

        .m_dec .layui-this {
            color: #1E9FFF !important;
            font-weight: bold;
            font-size: 16px;
        }

        .m_dec .layui-this:after {
            border-color: #1E9FFF !important;
        }

        .m_dec_con {
            width: 100%;
            padding: 20px 0px;
            border-bottom: 1px #ccc solid;
        }

        .m_dec_type {
            width: 100%;
            padding: 20px 0px;
        }

        .m_dec_type>div {
            margin-bottom: 10px;
        }

        .m_dec .layui-tab-content {
            margin-left: 10px;
        }

        .m_comment {
            margin-top: 20px;
            margin-bottom: 20px;
            width: 100%;
            padding: 10px 20px;
            box-sizing: border-box;
            background: #fff;
            box-shadow: 0 4px 11px 0px #bbbbbb;
        }

        .m_c_top {
            padding: 0px 20px;
        }

        .m_c_total span {
            font-weight: bold;
        }

        .m_c_total textarea {
            margin: 10px 0px;
        }

        .m_c_icon {
            width: 50%;
            display: inline-block;
            cursor: pointer;
        }

        .m_c_btn {
            width: 50%;
            float: right;
        }

        .m_c_btn button {
            background: #1E9FFF !important;
            color: #fff !important;
        }

        .m_c_btn button {
            float: right;
        }

        .m_c_list {
            width: 100%;
            margin-top: 50px;
        }

        .m_user {
            display: inline-block;
        }

        .m_user img {
            width: 30px;
            height: 30px;
            border-radius: 100%;
        }

        .m_user span {
            padding-left: 10px;
        }

        .m_c_time {
            width: 20%;
            display: inline-block;
            margin-left: 10px;
        }

        .m_c_time span {
            color: #8a8a8a;
        }

        .m_c_reply {
            float: right;
        }

        .m_c_reply button {
            background: unset;
            color: #888;
            font-weight: bold;
        }

        .m_c_reply button:hover {
            color: unset;
        }

        .m_user_bottom {
            padding: 10px 45px;
        }

        .m_c_list ul li {
            padding: 20px 0;
            border-bottom: 1px #ccc solid;
        }

        .m_c_list ul li:last-child {
            border-bottom: none !important;
        }

        .m_user p {
            font-size: 16px;
            color: #868686;
            margin-left: 10px;
            font-weight: bold;
        }

        .m_c_total>div {
            margin: 10px 0;
        }

        .textarea_0:empty:before {
            content: '我来说两句';
            color: gray;
        }

        .textarea_0:focus:before {
            content: none;
        }

        .textarea_reply:empty:before {
            content: attr(data-before);
            color: gray;
        }

        .textarea_reply:focus:before {
            content: none;
        }

        .replySpan {
            color: #868686;
        }

        .reply_total {
            width: 95%;
            margin: auto;
            margin-bottom: 30px;
        }

        .replyLi {
            background: #f2f2f2;
            padding: 20px !important;
            box-sizing: border-box;
            width: 98%;
            margin: auto;
        }

        .replyLi p {
            margin-bottom: 15px;
        }

        .replyLi span {
            color: #868686;
        }

        .replyLi button {
            background: unset;
            color: #000;
            float: right;
            font-size: 14px;
            padding: 0px 10px;
        }

        .replyLi button:hover {
            color: #888;
        }

        .resjx {
            width: 0;
            height: 0;
            border: 15px solid;
            border-color: transparent transparent #f2f2f2;
            margin-left: 40px;
        }

        .replyInreply {
            padding: 30px 20px;
            background: #fff;
            width: 100%;
            box-sizing: border-box;
            margin-top: 20px;
        }

        .icon-socre {
            cursor: pointer;
            width: 50px;
            height: 50px;
            padding: 5px;
            background: #1E9FFF;
            font-size: 14px;
            border-radius: 3px;
            color: #fff;
        }

        .uOperate>ul>li {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 50px;
        }

        .collect span {
            font-size: 30px;
        }

        .red {
            color: #c00;
        }

        #app-score {
            width: 170px;
            position: absolute;
            line-height: 39px;
            right: 150px;
            bottom: -60px;
        }

        .layui-rate li i.layui-icon {
            color: #1E9FFF
        }

        .socreGo {
            display: none;
            color: #fff;
            position: absolute;
            right: 80px;
            top: 75px;
        }

        .socreCancel {
            display: none;
            color: #fff;
            position: absolute;
            right: 25px;
            top: 75px;
        }

        .m_dec_title {
            font-size: 16px;
            font-weight: bold;
            margin: 10px 0px;
        }
    </style>
</head>

<body style="width: 100%;padding: 0px;">

    <div class="m">
        <div class="m_cover_cesium">
            <iframe frameborder="none" width="100%" height="100%" id="cesiumIfm"></iframe>
            <!--全屏-->
            <i class="layui-icon totalIn">&#xe622;</i>
            <i class="layui-icon totalOut">&#xe758;</i>
        </div>

        <div class="m_author">
            <div class="m_name">-----</div>
            <div class="m_data">
                <div>
                    <i class="layui-icon">&#xe67a;</i>
                    <span class="score"></span>
                </div>
                <div>
                    <span style="font-size: 14px">收藏</span>
                    <span class="iconfont iconshoucang" style="font-size: 20px; cursor: pointer;"></span>
                    <!--收藏-->
                </div>
                <div>
                    <span class="icon-socre">我要评分</span>
                </div>
                <button type="button" class="layui-btn layui-btn-sm layui-btn-normal socreGo"> 提交</button>
                <button type="button" class="layui-btn layui-btn-sm layui-btn-normal socreCancel"> 取消</button>
            </div>
            <div class="m_author_photo">
                <img src="../static/IMG/Mould/m_author.png">
            </div>
            <div class="m_author_name">
                <p>---</p>
                <button status="nofollow" type="button" class="layui-btn layui-btn-sm layui-btn-normal follow"><i
                        class="layui-icon ">&#xe624;</i> 关注
                </button>
            </div>
        </div>

        <div class="m_cover"
            style=" background: #fff;  box-shadow: 0 4px 11px 0px #bbbbbb;margin-top: 20px; padding:10px 0 0 20px;box-sizing: border-box">
            <div class="m_dec_title">作品描述</div>
            <div class="m_dec_con">-----</div>
            <div class="m_dec_type">
                <div>
                    发布时间：<span class="m_dec_time">-----</span>
                </div>
                <div>
                    数据类型：<span>------</span>
                </div>
            </div>
        </div>
        <div class="m_comment layui-form">
            <div class="m_c_top">
                <div class="m_c_total">
                    <span>评论共（--）条</span>
                    <div contenteditable="true" autocomplete="off" class="layui-textarea textarea_0"
                        placeholder="我来说两句"></div>
                </div>
                <div class="m_c_bottom">
                    <div class="m_c_icon">
                        <span class="layui-icon layim-tool-face" name="face_0" title="选择表情" layim-event="face"></span>
                    </div>
                    <div class="m_c_btn">
                        <button type="button" class="layui-btn layui-btn-normal" onclick="comment()">发表评论</button>
                    </div>
                </div>
            </div>
            <div class="m_c_list">
                <ul>
                </ul>
            </div>
        </div>
    </div>
    <script src="../JS/jquery-2.0.3.js"></script>
    <script src="../layui/layui.js" charset="utf-8"></script>
    <script>
        var id = 0;//当前数据的id
        var type = 0;//当前数据的类型
        var userId = 0; //当前数据的创建者id

        $(function () {
            layui.use(['element', 'form', 'rate', 'layim'], function () {
                var element = layui.element,
                    form = layui.form
                    , rate = layui.rate
                    , layim = layui.layim;
                var arrs = {
                    '0.5': '1分'
                    , '1': '2分'
                    , '1.5': '3分'
                    , '2': '4分'
                    , '2.5': '5分'
                    , '3': '6分'
                    , '3.5': '7分'
                    , '4': '8分'
                    , '4.5': '9分'
                    , '5': '10分'
                };
                $('.icon-socre').click(function () {
                    //判断是否登录
                    //判断是否登录
                    if (!parent.isLogin) {
                        parent.sysPopups('账号登录', './HTML/login/login.html', 400, 310, '');
                        return
                    }
                    $('#app-score').remove();
                    $(this).parent().append('<div id="app-score"></div>');
                    $that = $(this);
                    rate.render({
                        elem: '#app-score'
                        , value: 3
                        , text: true
                        , half: true //开启半星
                        , setText: function (value) { //自定义文本的回调
                            this.span.text(arrs[value] || (value + "分"));
                        }
                        , choose: function (value) { //点击产生的回调
                            $that.find('.sc').text(arrs[value] || (value + "分"))
                        }
                    });
                    $('#app-score').show();
                    $('.socreGo').show();
                    $('.socreCancel').show();
                })
            })
            //全屏功能
            $('.totalIn').click(function () {
                $(this).hide();
                $('.totalOut').show();
                $('body').css('overflow', 'hidden');
                //获取当前屏幕的宽高
                var w = $(window).width();
                var h = $(window).height();
                //父级宽度100%
                $('.m').css({ 'width': '100%', 'margin-top': 0 });
                $('.m_cover_cesium').width(w).height(h).css('z-index', 1);
            })
            $('.totalOut').click(function () {
                $(this).hide();
                $('.totalIn').show();
                $('body').css('overflow-y', 'auto');
                //父级宽度100%
                $('.m').css({ 'width': '80%', 'margin-top': '20px' });
                $('.m_cover_cesium').width('100%').height('700px');
            })

            // 判断是否为评论跳转
            var comment = parent.getUrlParam(window.location.search, 'comment');
            if (comment == '1') {
                $(document).scrollTop($('.m_comment').offset().top);
            }

            //获取该数据的id和类型
            id = parseInt(parent.getUrlParam(window.location.search, 'id'));
            type = parseInt(parent.getUrlParam(window.location.search, 'type'));
            //调用接口获取详细数据
            getDataByType(id, type)

            //评分事件
            var scoreUrl = ['/app/ratingScore', '/template/ratingScore', '/data/ratingScore', '/style/ratingScore', ''];
            $('.socreGo').click(function () {
                var score = $('#app-score span').text().replace(/[^0-9]/ig, "");
                //调用评分接口
                parent.ajaxPost(parent.defaultUrl + scoreUrl[type], {
                    'pfuserid': parent.getLocalStorage('JSXM').id,
                    'objid': id,
                    'score': score
                }, function (data) {
                    if (data.code === 200) {
                        layer.msg('评分成功')
                    } else if (data.message) {
                        layer.msg(data.message)
                    }
                })
            })
            //取消评分
            $('.socreCancel').click(function () {
                $('#app-score').hide();
                $('.socreGo').hide();
                $('.socreCancel').hide();
            })

            // 收藏
            var isfavourUrl = ['/app/insertFavour', '/template/insertFavour', '/data/insertFavour', '/style/insertFavour', ''];
            var unfavourUrl = ['/app/delFavourById', '/template/delFavourById', '/data/delFavourById', '/style/delFavourById', ''];
            $('.iconshoucang').click(function () {
                if (!$(this).hasClass('red')) {
                    //判断是否登录
                    if (!parent.isLogin) {
                        parent.sysPopups('账号登录', './HTML/login/login.html', 400, 310, '');
                        return
                    }
                    //调用收藏接口
                    parent.ajaxPost(parent.defaultUrl + isfavourUrl[type], {
                        "objid": id,
                        "userid": parent.getLocalStorage('JSXM').id
                    }, function (data) {
                        if (data.code === 200) {
                            $('.iconshoucang').prev().text('已收藏');
                            $('.iconshoucang').addClass('red');
                            layer.msg('收藏成功');
                        } else if (data.message) {
                            layer.msg(data.message)
                        }
                    })
                } else {
                    //调用取消收藏接口
                    parent.ajaxGet(parent.defaultUrl + unfavourUrl[type], { "id": id }, function (data) {
                        if (data.code === 200) {
                            $('.iconshoucang').prev().text('收藏');
                            $('.iconshoucang').removeClass('red');
                            layer.msg('取消收藏');
                        } else if (data.message) {
                            layer.msg(data.message)
                        }
                    })
                    $(this).removeClass('red');
                }
            });

            //关注
            $('.follow').click(function () {
                //判断是否登录
                if (!parent.isLogin) {
                    parent.sysPopups('账号登录', './HTML/login/login.html', 400, 310, '');
                    return
                }
                //判断是否已关注
                if ($(this).attr('status') === 'follow') {
                    //调用取关接口
                    parent.ajaxGet(parent.defaultUrl + '/cancelFollow', {
                        'followUserId': userId
                    }, function (data) {
                        if (data.code === 200) {
                            layer.msg('取消关注');
                            $('.follow').html('<i class="layui-icon ">&#xe624;</i>关注');
                            $('.follow').attr('status', 'nofollow');
                        } else if (data.message) {
                            layer.msg(data.message)
                        }
                    })
                } else {
                    //调用关注接口
                    parent.ajaxGet(parent.defaultUrl + '/followUser', {
                        'followUserId': userId
                    }, function (data) {
                        if (data.code === 200) {
                            layer.msg('关注成功');
                            $('.follow').html('<i class="layui-icon ">&#xe605;</i>已关注');
                            $('.follow').attr('status', 'follow');
                        } else if (data.message) {
                            layer.msg(data.message)
                        }
                    })
                }
            })

        })

        function comment() {

            //判断是否登录
            if (!parent.isLogin) {
                parent.sysPopups('账号登录', './HTML/login/login.html', 400, 310, '');
                return
            }

            //判断是否有内容
            var chtml = $('.textarea_0').html();
            if (chtml === '') {
                parent.layer.msg('请输入评论内容')
            } else {
                //调用评论接口
                commentGo(chtml, 0)
            }
        }

        function reply(obj, id) {
            var replyuser = $(obj).parent().parent().find('.m_user span').text();
            //获取页面表情按钮个数
            var len = $('.layim-tool-face').length;
            $(obj).parent().parent().parent().append('      <div class="reply_total"> <div class="m_c_total">\n' +
                '                <div contenteditable="true" autocomplete="off" class="layui-textarea textarea_' + len + ' textarea_reply"></div>\n' +
                '            </div>\n' +
                '            <div class="m_c_bottom">\n' +
                '                <div class="m_c_icon">\n' +
                '                    <span class="layui-icon layim-tool-face" name="face_' + len + '" title="选择表情" layim-event="face"></span>\n' +
                '                </div>\n' +
                '                <div class="m_c_btn">\n' +
                '                    <button style="margin-left: 10px" type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="commentDo(this,\'' + id + '\')">确认</button>\n' +
                '                    <button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="commentCancel(this)">取消</button>\n' +
                '                </div>\n' +
                '            </div></div>');
            $('.textarea_' + len + '').attr('data-before', '回复' + replyuser + ':');
        }

        //取消回复
        function commentCancel(obj) {
            $(obj).parent().parent().parent().remove();
        }

        //确认回复
        function commentDo(obj, cid) {
            var rehtml = $(obj).parent().parent().prev().children().html();
            if (rehtml === '') {
                parent.layer.msg('请输入回复内容');
                return;
            }
            //调用接口
            commentGo(rehtml, parseInt(cid))
        }

        //回复中回复
        function replyIn(obj, id) {
            var reuser = $(obj).parent().find('p').attr('name');
            //获取页面表情按钮个数
            var len = $('.layim-tool-face').length;
            $(obj).parent().append('<div class="reply_total replyInreply"> <div class="m_c_total">\n' +
                '                <div contenteditable="true" autocomplete="off" class="layui-textarea textarea_' + len + ' textarea_reply"></div>\n' +
                '            </div>\n' +
                '            <div class="m_c_bottom">\n' +
                '                <div class="m_c_icon">\n' +
                '                    <span class="layui-icon layim-tool-face" name="face_' + len + '" title="选择表情" layim-event="face"></span>\n' +
                '                </div>\n' +
                '                <div class="m_c_btn">\n' +
                '                    <button style="margin-left: 10px" type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="replyDo(this,\'' + id + '\')">确认</button>\n' +
                '                    <button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="commentCancel(this)">取消</button>\n' +
                '                </div>\n' +
                '            </div></div>');
            $('.textarea_' + len + '').attr('data-before', '回复' + reuser + ':');
        }

        //回复中回复确认
        function replyDo(obj, cid) {
            obj = $(obj);
            var rehtml = obj.parent().parent().prev().children().html();
            if (rehtml === '') {
                parent.layer.msg('请输入回复内容');
                return;
            }
            //调用接口
            commentGo(rehtml, parseInt(cid))
        }


        //删除回复
        function replyDetele(obj) {
            layer.confirm('确认删除该回复?', function (index) {
                //判断是不是唯一回复
                if ($(obj).parent().parent().find('.replyLi').length === 1) {
                    $(obj).parent().parent().remove();
                } else {
                    $(obj).parent().remove();
                }
                layer.close(index);
            });

        }

        //根据不同类型调用接口返回详细数据
        // type 0表示应用 1表示模块 2表示数据 3表示样式
        function getDataByType(id, type) {
            var url = ['/app/selAppById', '/template/selTemplateById', '/data/selDataById', '/style/selStyleById', ''];
            parent.ajaxGet(parent.defaultUrl + url[type], { id: id }, function (data) {
                if (data.code === 200) {
                    $('.m_name').text(data.data.name);
                    $('.m_author_name p').text(data.data.username || data.data.userName);
                    $('.m_dec_con').text(data.data.desc || data.data.dataDes);
                    $('.m_dec_time').text(data.data.time);
                    $('.score').text(data.data.score);
                    $('.m_c_total span').text('评论共（' + data.data.commentnum + '）条');
                    if (data.data.isfavour) {
                        $('.iconshoucang').addClass('red');
                        $('.iconshoucang').prev().text('已收藏')
                    }
                    //获取关注状态
                    if (data.data.isfollow) {
                        $('.follow').attr('status', 'follow').html('<i class="layui-icon ">&#xe605;</i>已关注');
                    }
                    userId = data.data.userId;
                    //评论内容显示
                    if (data.data.reply && data.data.reply.length > 0) {
                        var reply = data.data.reply;
                        for (var i = 0, l = reply.length; i < l; i++) {
                            commentHtml(reply[i], i, 0, '');
                        }
                    }
                    //显示数据创建者名称头像
                    $('.m_author_photo img').attr('src', data.data.userphoto);
                    $('.m_author_name p').text(data.data.username);

                    //根据不同类型处理
                    switch (type) {
                        case '0'://应用
                            //通过id调用工程模板和功能模板
                            parent.ajaxGet(parent.defaultUrl + '/template/selTemplateById',
                                { 'id': data.data.projectTemplateId}
                                , function (data) {
                                    if (data.code === 200) {
                                        //工程树数据转化
                                        $cesuimWin.treeInit(data.data.projectTree);
                                        //球初始化定位
                                        cesuim_posi = data.data.position ? JSON.parse(data.data.position) : '';
                                        if (cesuim_posi) {
                                            //判断获取的数据中是否有属性值为空
                                            var flag = false;
                                            for (key in cesuim_posi) {
                                                if (cesuim_posi[key] === '') {
                                                    flag = true;
                                                    break;
                                                }
                                            }
                                            form.val('mEdit', cesuim_posi);
                                            if (!flag) {
                                                $cesuimWin.flyPosi(cesuim_posi);
                                            }
                                        }
                                    } else if (data.message) {
                                        layer.msg(data.message)
                                    }
                                })
                            parent.ajaxGet(parent.defaultUrl + '/template/selTemplateById',
                                { 'id': data.data.menuTemplateId}
                                , function (data) {
                                    if (data.code === 200) {
                                        data.data.menus ? $cesuimWin.setFuncNav(JSON.parse(data.data.menus)) : '';
                                        data.data.tools ? $cesuimWin.setToolNav(JSON.parse(data.data.tools)) : '';
                                    } else if (data.message) {
                                        layer.msg(data.message)
                                    }
                                })
                            break;
                    }

                    //球显示数据
                    window.datatype = data.data.dataType;
                    $('#cesiumIfm').attr('src', '../Cesium/index.html')

                } else if (data.message) {
                    layer.msg(data.message)
                }
            })
        }

        //评论内容显示html
        //data 评论数据 type 0表示第一级评论 1表示回复的评论 index当前评论下标 name被回复人昵称
        function commentHtml(data, index, type, name) {
            //判断type
            if (type) {
                $('li[level=' + index + ']').append('<li class="replyLi">' +
                    '<p name="' + data.username + '">' + data.username + ' :回复了' + name + ': ' + data.content + '</p>' +
                    '<span>' + data.time + '</span>' +
                    ' <button style="margin-left: 10px" type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="replyIn(this,\'' + data.id + '\')">回复</button>\n' +
                    ' <button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="replyDetele(this)">删除</button>\n' +
                    '</li>');
            } else {
                var show = data.nextNodes && data.nextNodes.length > 0 ? 'block' : 'none';
                $('.m_c_list ul').append('<li level="' + index + '">\n' +
                    '                    <div class="m_user_top">\n' +
                    '                        <div class="m_user">\n' +
                    '                            <img src="' + data.userphoto + '">\n' +
                    '                            <span>' + data.username + '</span>\n' +
                    '                        </div>\n' +
                    '                        <div class="m_c_time">\n' +
                    '                            <span>' + data.time + '</span>\n' +
                    '                        </div>\n' +
                    '                        <div class="m_c_reply">\n' +
                    '                            <button type="button" class="layui-btn layui-btn-normal" onclick="reply(this,\'' + data.id + '\')">回复</button>\n' +
                    '                        </div>\n' +
                    '                    </div>\n' +
                    '                    <div class="m_user_bottom">\n' +
                    '                        <span>' + data.content + '</span>\n' +
                    '                    </div>\n' +
                    '<div style="display: ' + show + '" class="resjx"></div>' +
                    '                </li>')
            }

            //判断有没有nextNodes字段
            if (data.nextNodes && data.nextNodes.length > 0) {
                for (var i = 0, l = data.nextNodes.length; i < l; i++) {
                    commentHtml(data.nextNodes[i], index, 1, data.username)
                }
            }
        }

        //发布回复评论方法
        var commentUrl = ['/app/insertComment', '/template/insertComment', '/data/insertComment', '/style/insertComment', '']
        var selcommentUrl = ['/app/selComment', '/template/selComment', '/data/selComment', '/style/selComment', '']
        function commentGo(content, plid) {
            parent.ajaxPost(parent.defaultUrl + commentUrl[type], {
                "content": content,
                "objid": id,
                "plid": plid,
                "userid": parent.getLocalStorage('JSXM').id
            }, function (data) {
                if (data.code === 200) {
                    layer.msg('评论成功');
                    $('.textarea_0').html('');
                    //调用获取评论内容接口
                    parent.ajaxGet(parent.defaultUrl + selcommentUrl[type], { 'id': id }, function (data) {
                        if (data.code === 200) {
                            $('.m_c_list ul').html('');
                            for (var i = 0, l = data.data.length; i < l; i++) {
                                commentHtml(data.data[i], i, 0, '');
                            }
                            //更新评论数
                            $('.m_c_total span').text('评论共（' + data.totle + '）条');
                        }

                    })
                } else if (data.message) {
                    layer.msg(data.message)
                }
            })
        }
    </script>
</body>

</html>